#!/usr/bin/env sh

if [ -n "$1" ]; then
	text="$(neopassmenu -m "$1")"
else
	text="$(neopassmenu -m)"
fi

if [ -z "$text" ]; then
	echo "message-warning 'neopassmenu: No text selected'" > "$QUTE_FIFO"
	exit 0
fi

echo "$text" | awk '/ /{print "insert-text '"'"'" $0 "'"'"'"} !/ /{print "insert-text " $0}' > "$QUTE_FIFO"
